package top.xuziyi.crawler.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import top.xuziyi.common.pojo.StockZs;

public interface StockZsDao extends JpaRepository<StockZs, String>
        , JpaSpecificationExecutor<StockZs> {

    //根据指数代码查询数据
    @Query(value = "select count(1) from stock_zs where symbol = ?", nativeQuery = true)
    public int findBySymbol(String symbol);

    @Modifying
    @Query(value = "UPDATE stock_zs SET `status` = ? WHERE symbol = ?", nativeQuery = true)
    void updateStatus(String status, String symbol);
}
